package ts

import (
	"errors"
	"fmt"
	"github.com/gin-gonic/gin"
	"jwgin/model/mysql"
	"jwgin/service"
	"jwgin/socket"
)

type T1 struct {
}

func (t *T1) Routers(Router *gin.RouterGroup) (R gin.IRoutes) {
	Router.GET("login", t.login)
	Router.GET("sj", t.shujuku)
	Router.POST("sj", t.getpost)
	return Router
}

func (T1) login(c *gin.Context) {
	ss := c.DefaultQuery("name", "枯藤")
	fmt.Println(ss)
	if socket.IsOk > 0 {
		socket.TempData <- []byte(ss)
	}

	c.String(200, "ok")
}

func (T1) shujuku(c *gin.Context) {
	panic(errors.New("你好"))
	user := mysql.AdminUser{}
	service.G.First(&user)
	c.JSON(200, user)
}

func (T1) getpost(c *gin.Context) {
	ss := c.DefaultQuery("name", "枯藤")
	fmt.Println(ss)
}
